# 准备语料
import numpy as np

from process.Assist import poetry_vector, word_num_map

batch_size = 64
n_chunk = len(poetry_vector)
x_batches = []
y_batches = []
for i in range(n_chunk):
    start_index = i * batch_size
    end_index = start_index + batch_size
    batches = poetry_vector[start_index: end_index]
    length = max(map(len, batches))
    xdata = np.full((batch_size, length), word_num_map[''], np.int32)
    for row in range(batch_size):
        xdata[row, :len(batches[row])] = batches[row]
        ydata = np.copy(xdata)
        ydata[:, :-1] = xdata[:, 1:]
        x_batches.append(xdata)
        y_batches.append(ydata)

    print(x_batches[0])
    print(y_batches[0])

